import _ from 'lodash';

export const getDragInfo = (el, isParent = false) => {
  if (!el) return null;

  const uuid = el.getAttribute('data-uuid');
  const index = el.getAttribute('data-index');
  
  if (!uuid || !index) {
    if (isParent) return null;

    return getDragInfo(el.parentNode, true);
  }

  return { uuid, index };
};

export const getData = (el, key) => {
  if (!el) return null;

  return el.getAttribute(`data-${key}`);
};